package cancer

import (
	"gitcode.com/G-YT/iHealth25/server/global"
	"gorm.io/datatypes"
)

type Cancer struct {
	ID        uint        `json:"id" gorm:"column:id;comment:id;"`
	Name      string      `json:"name" gorm:"column:name;comment:名称;"`
	Questions []Questions `json:"questions" gorm:"foreignKey:Cid;references:ID"`
}

type Questions struct {
	ID       uint   `json:"id" gorm:"primarykey;column:id"`
	Cid      uint   `json:"cid" gorm:"column:cid;comment:癌症ID"`
	Question string `json:"question" gorm:"column:question;comment:问题"`
	Cancer   Cancer `json:"-" form:"-" gorm:"->;foreignKey:Cid;references:ID;"`
}

type Options struct {
	global.GVA_MODEL
	UID      uint           `json:"uid" gorm:"column:uid;comment:用户ID"`
	Options  datatypes.JSON `json:"options" gorm:"column:options;comment:选项集"`
	IsInfect *bool          `json:"is_infect" gorm:"column:is_infect;comment:是否感染过(新冠)肺炎"`
	IsInject *bool          `json:"is_inject" gorm:"column:is_inject;comment:是否注射过(新冠)疫苗"`
}

func (Cancer) TableName() string {
	return "fd_cancer"
}

func (Questions) TableName() string {
	return "fd_cancer_question"
}

func (Options) TableName() string {
	return "fd_cancer_options"
}
